<?php
/**
 * 获取需要提醒的医嘱
 * @authors xiadx (xiadx@zpdchina.com)
 * @date    2017-03-08 17:49:09
 * @version $Id$
 */

class GetyizhutixingdataController extends Yaf_Controller_Abstract {

    public function indexAction()
    {
    	$request = $this->getRequest();
    	$user_department = $request->getPost('user_department', '');
    	/*获取zhuyuan_id*/
    	if($user_department == "")
        {
            Utility::apiJsonError(20031, '科室不能为空');
        }
    	$zhuyuan_mod = new ZhuyuanBasicInfoModel;
    	$zhuyuan_basic_info = $zhuyuan_mod->getZhyuanIdList($user_department);
    	$zhuyuan_ids = Utility::array_pluck($zhuyuan_basic_info, 'zhuyuan_id');
    	/*end*/

    	$tixing_mod = new ZhuyuanYizhuTixingInfoModel;
    	$data = $tixing_mod->ls($user_department,$zhuyuan_ids);

    	if (empty($data)) {
    		Utility::apiJsonResultExtends(['error' => 200, 'msg' => '暂无数据', 'update_sql' => '']);
    	}
    	$field_arr = $tixing_mod->_field_arr;
    	$async_result['update_sql'] = Utility::formatToSqlStrExtends($data, 'xinyizhu_tixing_info', 'update_sql', $field_arr);
    	$async_result['error'] = 200;
    	$async_result['msg'] = '';
    	Utility::apiJsonResultExtends($async_result);
    }
}
